package com.df.ez_game.server;

import com.df.ez_game.server.logic.JsonCodec;
import com.df.ez_game.server.logic.ProtobufCodec;

import java.util.HashMap;
import java.util.Map;

public class EzGameMsgCodecManager {
    private static Map<Integer,IEzGameMsgCodec> codecMap = new HashMap<>();

    static {
        codecMap.put(MsgProtocType.JSON.getValue(),new JsonCodec());
        codecMap.put(MsgProtocType.PROTOBUF.getValue(),new ProtobufCodec());
    }


    public static IEzGameMsgCodec getCodec(Integer msgProtoType){
        return codecMap.get(msgProtoType);
    }

    public static void  setCodec(Integer msgProtoType,IEzGameMsgCodec codec){
        codecMap.put(msgProtoType,codec);
    }
}
